<html> 
<head> 
<title> </title>
<style> 
px {font-family: "Lucida Console", Monaco, monospace }
p { font-size:100%; line-height:1.1em; }
body {xfont-style: sans-serif}
body {
color:#333; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:1em; line-height:1.3em; }
a:visited { color:#666; }
h1,h2,h3,h4,h5,h6 { color:#333; font-family:georgia, verdana, sans-serif; }
h1 { font-size:150%; page-break-before:auto;background-color: #aaaaff}
h2 { font-size:143%;color:teal; }
h3 { font-size:134%;color:blue; }
h4 { font-size:120%;color:gray; }
img { max-width: 55em}
p{ padding: 0;margin:0; }
p{ padding-right:1.4em; }
p{ padding-bottom:0.1em; }
p{ padding-top:1em; }
p{ whitespace: pre-wrap; }
h5,h6 { font-size:100% }
a.nav,a:link.nav, a:visited.nav { background-color:#FFF; color:#000; }
XXtable { border:double #000; border-collapse:collapse; }
XXtable { border-collapse:collapse; }
XXtd { border:thin solid #888; }
XXtd { border:none; }
li { margin-bottom:0.5em; }
blockquote { display:block; font-size:100%; line-height:1.1em; margin:0 0 0.5em; padding:0 2.5em; }
pre { background-color:#DDD; font-size:100%; overflow:auto; padding:1em; }
a,li span { color:#000; }
a:hover, a.nav:hover, a:hover math { background-color:#000; color:#FFF; }
#Container { margin:0 10px; text-align:center; background-color: #BBB}
#Content { border-top:none; margin:auto; padding:0.3em; text-align:left; width:100%; max-width:55em; background:#FFF}
span.webName { font-size:.5em; }
textarea#content { font-size: 1em; line-height: 1.125; }
h1#pageName { line-height:1em; margin:0.2em 0 0.2em 0; padding:0; }
.property { color:#666; font-size:100%; }
a.existingWikiWord[title]{ //border: 1px dashed #BBB; }
.byline { color:#666; font-size:1.0em; font-style:italic; margin-bottom:1em; padding-top:1px; } 
</style> 
</head>
<BODY bgcolor=#F0F0F0 text=#000000 link=#0000ff vlink=#C000C0 alink=#ff0000><A NAME=top></A>
<!--
<h5><a href="https://github.com/urbanjost/M_CLI2">[UP]</a></h5>
<button type="button" onclick="javascript:history.back()">Back</button>
-->
<div id="Container">
<div id="Content">
<CENTER>
<H1><HR><I>Manual Reference Pages &nbsp;-&nbsp;</I><NOBR>M_CLI2 (3m_cli2)</NOBR><HR></H1>
</CENTER>
<A name=0>

     <H3>NAME</H3>

</A>
<BLOCKQUOTE>
<B>M_CLI2(3fm) </B>- [ARGUMENTS::M_CLI2::INTRO] command line argument
<B>parsing using a prototype command
</B><B>(LICENSE:PD)
</B></BLOCKQUOTE>
<A name=contents></A><H3>CONTENTS</H3></A>
<BLOCKQUOTE>
<A HREF=#1>Synopsis</A><BR>
<A HREF=#2>Description</A><BR>
<A HREF=#3>Example</A><BR>
<A HREF=#4>Author</A><BR>
<A HREF=#5>License</A><BR>
</BLOCKQUOTE>
<A name=6>

     <H3>SYNOPSIS</H3>

</A>
<BLOCKQUOTE>
<PRE>
<B>Available</B> <I>procedures</I> <I>and</I> variables:
<P>
     use M_CLI2, only : set_args, get_args, unnamed, remaining, args
     use M_CLI2, only : get_args_fixed_length, get_args_fixed_size
     use M_CLI2, only : specified
     ! convenience functions
     use M_CLI2, only : dget, iget, lget, rget, sget, cget
     use M_CLI2, only : dgets, igets, lgets, rgets, sgets, cgets
<P>
</PRE>
</BLOCKQUOTE>
<A name=2>

     <H3>DESCRIPTION</H3>

</A>
<BLOCKQUOTE>
Allow for command line parsing much like standard Unix command line
parsing using a simple prototype.
<P>
Typically one call to <B>SET_ARGS</B>(3f) is made to define the command
arguments, set default values <I>and</I> parse the command line. Then a call
is made to the convenience commands based on <B>GET_ARGS</B>(3f) for each
command keyword to obtain the argument values.
<P>
The documentation for <B>SET_ARGS</B>(3f) <I>and</I> <B>GET_ARGS</B>(3f) provides further
details.
</BLOCKQUOTE>
<A name=3>

     <H3>EXAMPLE</H3>

</A>
<BLOCKQUOTE>
<P>
Sample typical minimal usage
<P>
<PRE>
    program minimal
    use M_CLI2,  only : set_args, lget, rget, filenames=&gt;unnamed
    implicit none
    real    :: x, y
    integer :: i
       call set_args(&#146; -y 0.0 -x 0.0 -v F&#146;)
       x=rget(&#146;x&#146;)
       y=rget(&#146;y&#146;)
       if(lget(&#146;v&#146;))then
          write(*,*)&#146;X=&#146;,x
          write(*,*)&#146;Y=&#146;,y
          write(*,*)&#146;ATAN2(Y,X)=&#146;,atan2(x=x,y=y)
       else
          write(*,*)atan2(x=x,y=y)
       endif
       if(size(filenames) &gt; 0)then
          write(*,&#146;(g0)&#146;)&#146;filenames:&#146;
          write(*,&#146;(i6.6,3a)&#146;)(i,&#146;[&#146;,filenames(i),&#146;]&#146;,i=1,size(filenames))
       endif
    end program minimal
<P>
</PRE>
Sample program using type <B>get_args</B>() <I>and</I> variants
<P>
<PRE>
    program demo_M_CLI2
    use M_CLI2,  only : set_args, get_args
    use M_CLI2,  only : filenames=&gt;unnamed
    use M_CLI2,  only : get_args_fixed_length, get_args_fixed_size
    implicit none
    integer                      :: i
    integer,parameter            :: dp=kind(0.0d0)
    !
    ! DEFINE ARGS
    real                         :: x, y, z
    real(kind=dp),allocatable    :: point(:)
    logical                      :: l, lbig
    logical,allocatable          :: logicals(:)
    character(len=:),allocatable :: title    ! VARIABLE LENGTH
    character(len=40)            :: label    ! FIXED LENGTH
    real                         :: p(3)     ! FIXED SIZE
    logical                      :: logi(3)  ! FIXED SIZE
    !
    ! DEFINE AND PARSE (TO SET INITIAL VALUES) COMMAND LINE
    !   o set a value for all keywords.
    !   o double-quote strings
    !   o set all logical values to F or T.
    !   o value delimiter is comma, colon, or space
    call set_args(&#146;                         &
            & -x 1 -y 2 -z 3                &
            & -p -1 -2 -3                   &
            & --point 11.11, 22.22, 33.33e0 &
            & --title "my title" -l F -L F  &
            & --logicals  F F F F F         &
            & -logi F T F                   &
            & --label " " &
            ! note space between quotes is required
            & &#146;)
    ! ASSIGN VALUES TO ELEMENTS
    call get_args(&#146;x&#146;,x)         ! SCALARS
    call get_args(&#146;y&#146;,y)
    call get_args(&#146;z&#146;,z)
    call get_args(&#146;l&#146;,l)
    call get_args(&#146;L&#146;,lbig)
    call get_args(&#146;title&#146;,title) ! ALLOCATABLE STRING
    call get_args(&#146;point&#146;,point) ! ALLOCATABLE ARRAYS
    call get_args(&#146;logicals&#146;,logicals)
    !
    ! for NON-ALLOCATABLE VARIABLES
<P>
    ! for non-allocatable string
    call get_args_fixed_length(&#146;label&#146;,label)
<P>
    ! for non-allocatable arrays
    call get_args_fixed_size(&#146;p&#146;,p)
    call get_args_fixed_size(&#146;logi&#146;,logi)
    !
    ! USE VALUES
    write(*,*)&#146;x=&#146;,x, &#146;y=&#146;,y, &#146;z=&#146;,z, x+y+z
    write(*,*)&#146;p=&#146;,p
    write(*,*)&#146;point=&#146;,point
    write(*,*)&#146;title=&#146;,title
    write(*,*)&#146;label=&#146;,label
    write(*,*)&#146;l=&#146;,l
    write(*,*)&#146;L=&#146;,lbig
    write(*,*)&#146;logicals=&#146;,logicals
    write(*,*)&#146;logi=&#146;,logi
    !
    ! unnamed strings
    !
    if(size(filenames) &gt; 0)then
       write(*,&#146;(i6.6,3a)&#146;)(i,&#146;[&#146;,filenames(i),&#146;]&#146;,i=1,size(filenames))
    endif
    !
    end program demo_M_CLI2
<P>
</PRE>
</BLOCKQUOTE>
<A name=4>

     <H3>AUTHOR</H3>

</A>
<BLOCKQUOTE>
John S. Urban, 2019
</BLOCKQUOTE>
<A name=5>

     <H3>LICENSE</H3>

</A>
<BLOCKQUOTE>
Public Domain
</BLOCKQUOTE>
<P><HR>
<TABLE width=100%><TR> <TD width=33%><I>Nemo Release 3.1</I></TD> <TD width=33% align=center>M_CLI2 (3m_cli2)</TD> <TD align=right width=33%><I>December 21, 2022</I></TD> </TR></TABLE><FONT SIZE=-1>Generated by <A HREF="http://www.squarebox.co.uk/download/manServer.shtml">manServer 1.08</A> from 5a341200-4dc6-4c80-924c-c361ad50d0aa using man macros.</FONT>
<br><br><center><img src="images/M_CLI2.gif"></center>
</div>
</div>
</body>
</HTML>
